﻿using System.Collections.Generic;
using Castle.ActiveRecord;

namespace SampleApplication
{
    /// <summary>
    /// Encja klienta
    /// </summary>
    [ActiveRecord]
    public class Customer : ActiveRecordBase<Customer>
    {
        /// <summary>
        /// Id klienta
        /// </summary>
        [PrimaryKey]
        public int Id { get; set; }

        /// <summary>
        /// Pierwsze imię
        /// </summary>
        [Property]
        public string FirstName { get; set; }

        /// <summary>
        /// Drugie imię
        /// </summary>
        [Property]
        public string SecondName { get; set; }

        /// <summary>
        /// Nazwisko
        /// </summary>
        [Property]
        public string Surname { get; set; }

        /// <summary>
        /// Drugie nazwisko
        /// </summary>
        [Property]
        public string SecondSurname { get; set; }

        /// <summary>
        /// Pesel
        /// </summary>
        [Property]
        public string Pesel { get; set; }

        /// <summary>
        /// Adresy klienta
        /// </summary>
        [HasAndBelongsToMany(Table = "CustomerAddresses", ColumnKey = "customerid", ColumnRef = "addressid")]
        public IList<Address> Addresses { get; set; }

        /// <summary>
        /// Wypożyczenia klienta
        /// </summary>
        [HasMany]
        public IList<Rental> Rentals { get; set; }

        /// <summary>
        /// Konstruktor
        /// </summary>
        public Customer()
        {
            Addresses = new List<Address>();
            Rentals = new List<Rental>();
        }

    }
}
